#include "StdAfx.h"
#include "CoordFrame.h"

CCoordFrame::CCoordFrame(
						 float xLow, float xHigh, 
						 float yLow, float yHigh, 
						 float zLow, float zHigh, 
						 float lineWidth):
	m_xLow(xLow, 0.0, 0.0),
	m_xHigh(xHigh, 0.0, 0.0),
	m_yLow(0.0, yLow, 0.0),
	m_yHigh(0.0, yHigh, 0.0),
	m_zLow(0.0, 0.0, zLow),
	m_zHigh(0.0, 0.0, zHigh)
{
	m_colorX[0] = 1.0f; m_colorX[1] = 0.0f; m_colorX[2] = 0.0f;
	m_colorY[0] = 0.0f; m_colorY[1] = 1.0f; m_colorY[2] = 0.0f;
	m_colorZ[0] = 0.0f; m_colorZ[1] = 0.0f; m_colorZ[2] = 1.0f;

	m_lineWidth = lineWidth;

}

CCoordFrame::~CCoordFrame(void)
{
}

void CCoordFrame::Draw()
{
	glLineWidth(m_lineWidth);

	//X-Axis
	glColor3fv(m_colorX);
	glBegin(GL_LINES);
		glNormal3fv(((CVector3D)m_xLow).getNormVector());
		glVertex3fv(m_xLow);
		glNormal3fv(((CVector3D)m_xHigh).getNormVector());
		glVertex3fv(m_xHigh);
	glEnd();

	//Y-Axis
	glColor3fv(m_colorY);
	glBegin(GL_LINES);
		glNormal3fv(((CVector3D)m_yLow).getNormVector());
		glVertex3fv(m_yLow);
		glNormal3fv(((CVector3D)m_yHigh).getNormVector());
		glVertex3fv(m_yHigh);
	glEnd();

	//Z-Axis
	glColor3fv(m_colorZ);
	glBegin(GL_LINES);
		glNormal3fv(((CVector3D)m_zLow).getNormVector());
		glVertex3fv(m_zLow);
		glNormal3fv(((CVector3D)m_zHigh).getNormVector());
		glVertex3fv(m_zHigh);
	glEnd();
}